package com.fare.fdc.action;

import java.util.List;
import java.util.Locale;

import javax.annotation.Resource;

import org.springframework.stereotype.Controller;

import com.fare.taluo.BaseFdcAction;
import com.fare.taluo.application.analyse.AirCompanyTrendContrastLineApplication;
import com.fare.taluo.application.plane.channel.SourceApplication;
import com.fare.taluo.util.DateUtils;
import com.fare.taluo.vo.core.SourceEntityVO;

/**
 * 
 * 【航空公司走势对比（航线）】
 * 
 * @version
 * @author guokenye 2013-1-28 上午10:39:56
 * 
 */
@Controller("airCompanyTrendContrastLineAction")
public class AirCompanyTrendContrastLineAction extends BaseFdcAction {
	
	
	
	
	
	
	/**
	 * 
	 */
	private static final long serialVersionUID = 6109777428466569505L;
	//==============================================================================================================
	
	
	
	private String fromCity;
	private String fromCityCode;
	private String toCity;
	private String toCityCode;
	private String flightStartDate;
	private String flightEndDate;
	private Integer futureDay;//未来天数
	private String[] periods;//出发时段,AMPN
	private Integer selfStartPeriods;//自定义出发时段（开始）(小时)
	private Integer selfEndPeriods;//自定义出发时段（结束）(小时)
	private String compareCompanyHbaseKey;//比较公司（我行）
	private String[] comparedCompanyHbaseKeys;//被比较的其他公司
	private String dataSourceHbaseKey;//数据来源
	private List<SourceEntityVO> crawlCompanys;//所有的当前处于抓取状态的公司
	private List<SourceEntityVO> crawlChannels;//所有的当前处于抓取状态的渠道
	private SourceEntityVO myCompanyOrChannel;//指当前用户所在的公司或者渠道
	
	@Resource(name = "airCompanyTrendContrastLineApplicationImpl")
	private AirCompanyTrendContrastLineApplication airCompanyTrendContrastLineApplication;
	@Resource(name="sourceApplication")
	private SourceApplication sourceApplication;
	
	
	public String toAnalyseJSP() throws Exception {
		this.crawlCompanys=sourceApplication.findCrawlAirCompanys();
		this.crawlChannels=sourceApplication.findCrawlChannel();
		returnPageURL = "/fare/fdc/_zoushiduibiLine.jsp";
		request.setAttribute("maxDate", DateUtils.getDateAfter(29));//目前只支持30天的数据 
		return "dispatcher";
	}
	
	public void analyse()throws Exception{
		Locale locale =super.getLocale();
		String xml=this.airCompanyTrendContrastLineApplication.getFusionChartsXMLStr(
				fromCity, toCity,fromCityCode, toCityCode, 
				flightStartDate, flightEndDate, futureDay, 
				periods, selfStartPeriods, selfEndPeriods, 
				compareCompanyHbaseKey, comparedCompanyHbaseKeys, dataSourceHbaseKey,null,locale);
		super.toJSONOut(xml);
	}
	
	public String getFromCity() {
		return fromCity;
	}

	public void setFromCity(String fromCity) {
		this.fromCity = fromCity;
	}

	public String getToCity() {
		return toCity;
	}

	public void setToCity(String toCity) {
		this.toCity = toCity;
	}

	public String getFlightStartDate() {
		return flightStartDate;
	}

	public void setFlightStartDate(String flightStartDate) {
		this.flightStartDate = flightStartDate;
	}

	public String getFlightEndDate() {
		return flightEndDate;
	}

	public void setFlightEndDate(String flightEndDate) {
		this.flightEndDate = flightEndDate;
	}

	public Integer getFutureDay() {
		return futureDay;
	}

	public void setFutureDay(Integer futureDay) {
		this.futureDay = futureDay;
	}

	public String[] getPeriods() {
		return periods;
	}

	public void setPeriods(String[] periods) {
		this.periods = periods;
	}

	public Integer getSelfStartPeriods() {
		return selfStartPeriods;
	}

	public void setSelfStartPeriods(Integer selfStartPeriods) {
		this.selfStartPeriods = selfStartPeriods;
	}

	public Integer getSelfEndPeriods() {
		return selfEndPeriods;
	}

	public void setSelfEndPeriods(Integer selfEndPeriods) {
		this.selfEndPeriods = selfEndPeriods;
	}

	public String getCompareCompanyHbaseKey() {
		return compareCompanyHbaseKey;
	}

	public void setCompareCompanyHbaseKey(String compareCompanyHbaseKey) {
		this.compareCompanyHbaseKey = compareCompanyHbaseKey;
	}

	public String[] getComparedCompanyHbaseKeys() {
		return comparedCompanyHbaseKeys;
	}

	public void setComparedCompanyHbaseKeys(String[] comparedCompanyHbaseKeys) {
		this.comparedCompanyHbaseKeys = comparedCompanyHbaseKeys;
	}

	public String getDataSourceHbaseKey() {
		return dataSourceHbaseKey;
	}

	public void setDataSourceHbaseKey(String dataSourceHbaseKey) {
		this.dataSourceHbaseKey = dataSourceHbaseKey;
	}

	public List<SourceEntityVO> getCrawlCompanys() {
		return crawlCompanys;
	}

	public void setCrawlCompanys(List<SourceEntityVO> crawlCompanys) {
		this.crawlCompanys = crawlCompanys;
	}

	public List<SourceEntityVO> getCrawlChannels() {
		return crawlChannels;
	}

	public void setCrawlChannels(List<SourceEntityVO> crawlChannels) {
		this.crawlChannels = crawlChannels;
	}

	public SourceEntityVO getMyCompanyOrChannel() {
		return myCompanyOrChannel;
	}

	public void setMyCompanyOrChannel(SourceEntityVO myCompanyOrChannel) {
		this.myCompanyOrChannel = myCompanyOrChannel;
	}

	public AirCompanyTrendContrastLineApplication getAirCompanyTrendContrastLineApplication() {
		return airCompanyTrendContrastLineApplication;
	}

	public void setAirCompanyTrendContrastLineApplication(
			AirCompanyTrendContrastLineApplication airCompanyTrendContrastLineApplication) {
		this.airCompanyTrendContrastLineApplication = airCompanyTrendContrastLineApplication;
	}

	public SourceApplication getSourceApplication() {
		return sourceApplication;
	}

	public void setSourceApplication(SourceApplication sourceApplication) {
		this.sourceApplication = sourceApplication;
	}

	public String getFromCityCode() {
		return fromCityCode;
	}

	public void setFromCityCode(String fromCityCode) {
		this.fromCityCode = fromCityCode;
	}

	public String getToCityCode() {
		return toCityCode;
	}

	public void setToCityCode(String toCityCode) {
		this.toCityCode = toCityCode;
	}
	
	

    
	
}
